home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Mac OS USB DDK_v1.0.1 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-03  |  2.6 KB  |  90 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. Boolean    immediateError(OSStatus err);
  22. void    MouseModuleInitiateTransaction(USBPB *pb);
  23. void    MouseModuleDelayCompletionProc(USBPB *pb);
  24. void     TransactionCompletionProc(USBPB *pb);
  25. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  26.  
  27. /*    Prototypes from MouseModuleHeader.c    Tue, Mar 17, 1998 3:30:22 PM    */
  28. static     OSStatus    MouseModuleInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  29. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  30. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  31.  
  32.  
  33. /*    Prototypes from MouseConfigParse.c    Tue, Mar 17, 1998 3:17:14 PM    */
  34. OSErr     FindHIDInterfaceByNumber(LogicalAddress pConfigDesc, UInt32 ReqInterface, USBInterfaceDescriptorPtr * hInterfaceDesc);
  35.  
  36. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  37. void     NotifyRegisteredHIDUser(UInt32 devicetype, UInt8 hidReport[]);
  38.  
  39. void     USBMouseIn(UInt32 refcon, void * theData);
  40. void     InitParamBlock(USBDeviceRef theDeviceRef, USBPB * paramblock);
  41.  
  42. #define kMouseRetryCount    3
  43.  
  44. enum driverstages
  45. {
  46.     kUndefined = 0,
  47.     kGetFullConfiguration,
  48.     kFindInterfaceAndSetProtocol,
  49.     kSetIdleRequest,
  50.     kFindAndOpenInterruptPipe,
  51.     kReadInterruptPipe,
  52.     kReturnFromDriver =     0x1000,
  53.     kRetryTransaction =     0x2000,
  54.     kSyncTransaction =         0x4000,
  55.     kCompletionPending =     0x8000
  56. };
  57.  
  58. typedef struct
  59. {
  60.     USBPB                             pb;
  61.     void (*handler)(USBPB             *pb);
  62.  
  63.     USBDeviceRef                    deviceRef;
  64.     USBInterfaceRef                    interfaceRef;
  65.     USBPipeRef                        pipeRef;
  66.     
  67.     USBDeviceDescriptor             deviceDescriptor;
  68.     USBInterfaceDescriptor            interfaceDescriptor;
  69.  
  70.     USBConfigurationDescriptorPtr     pFullConfigDescriptor;
  71.     USBInterfaceDescriptorPtr        pInterfaceDescriptor;
  72.     USBEndPointDescriptorPtr        pEndpointDescriptor;
  73.  
  74.     UInt32                            hidDeviceType;
  75.     UInt8                            hidReport[64];
  76.     
  77.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  78.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  79.     
  80.     UInt32                            interruptRefcon;
  81.     
  82.     SInt32                             retryCount;
  83.     SInt32                            transDepth;
  84.     
  85.     CursorDevicePtr                    pCursorDeviceInfo;
  86.     CursorDevice                    cursorDeviceInfo;
  87.     Fixed                            unitsPerInch;
  88. } usbMousePBStruct;
  89.  
  90. #endif //__MouseModuleH__